<template>
  <ant-modal modalWidth="576" modalHeight="500" :visible="open" :modal-title="formTitle" :adjust-size="true" @cancel="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="24">
          <a-form-model-item label="帖子" prop="itemId">
            <select-post ref="selectPost" v-model="form.itemId" placeholder="请选择帖子"></select-post>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="用户" prop="userId">
            <select-user v-model="form.userId" select-model="single" placeholder="请选择用户" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="通知类型" prop="type">
            <a-select
              placeholder="请选择类型"
              v-model="form.type"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear
            >
              <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="通知标题" prop="title">
            <a-input v-model="form.title" placeholder="请输入通知标题" />
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="通知内容" prop="content">
            <a-textarea v-model="form.content" placeholder="请输入通知内容" :rows="4" />
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel"> 取消 </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)"> 保存 </a-button>
    </template>
  </ant-modal>
</template>
<script>
import NotificationAddForm from './NotificationForm'
export default {
  ...NotificationAddForm
}
</script>
